<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: header"></head>

<body>

</body>
<div th:include="include :: footer"></div>

<div class="container">
    <table class="table table-condensed">
        <tbody>
        <tr th:each="contact : ${list}">
            <td>
                <span style="color:Red; font-weight:bold;" class="addonz">寄送到</span>
                <input type="radio"  name="contactId" id="contactId" th:value="${contact.contactId}"></td>
            <td><strong th:text="${contact.consignee}"></strong></td>
            <td style="text-indent:10px;"><strong th:text="${@dict.getLabel('transaction_country',contact.countryId)}"></strong></td>
            <td align="left" width="400px;"><div style="margin-left:15px; line-height:normal; word-break:break-all"><font style="color: #0d8ddb" th:text="${'地址: '+contact.address}"></font></div></td>
            <td><strong th:text="${contact.tel}"></strong></td>
            <td><a href="#" th:if="${contact.defaultContact==0}" th:onclick="setDefaultContact([[${contact}]])">设为默认地址</a></td>
            <td><a href="#" th:if="${contact.defaultContact==0}">删除</a></td>
        </tr>
        </tbody>
    </table>

</div>
<script>
    var prefix = ctx + "transaction/contact";
    function setDefaultContact(contact) {
        var config ={
            url: 'changeDefaultContact/'+contact.contactId,
            type: 'post',
            dataType: 'json',
            contentType: 'application/json',
            beforeSend: function () {
                $.modal.loading("正在处理中，请稍后...");
            }, success: function(result) {
                $.modal.closeLoading();
               // var a =parent.$("iframe")[0].contentWindow.$("#consignee").val();
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
                window.parent.location.reload();
            }
        }
        $.ajax(config);

    }

</script>

</html>
